﻿CREATE TABLE [dbo].[Order] (
    [OrdreId]        INT NOT NULL,
    [KundeNr]        INT           NOT NULL,
    [OrderStateId]   INT           NOT NULL,
    [LeveringAtt]    NVARCHAR (50) NULL,
    [LeveringNavn]   NVARCHAR (50) NOT NULL,
    [LeveringGade]   NVARCHAR (50) NOT NULL,
    [LeveringPostNr] INT           NOT NULL,
    [LeveringBy]     NVARCHAR (50) NOT NULL,
    [Oprettet]       DATETIME      NOT NULL,
    [Total] MONEY NOT NULL, 
    CONSTRAINT [PK_Order] PRIMARY KEY CLUSTERED ([OrdreId] ASC),
    CONSTRAINT [FK_Order_Customer] FOREIGN KEY ([KundeNr]) REFERENCES [dbo].[Customer] ([TelefonNr]),
    CONSTRAINT [FK_Order_OrderStarte] FOREIGN KEY ([OrderStateId]) REFERENCES [dbo].[OrderState] ([Id])
);

